import 'package:enjoy_plus_community/constants/gaode.dart';
import 'package:enjoy_plus_community/utils/http.dart';
import 'package:enjoy_plus_community/utils/toast.dart';

// 根据经纬度获取位置名称
Future<String> reverseGeocoding(double latitude, double longitude) async {
  String url =
      '$baseUrl/geocode/regeo?location=$longitude,$latitude&key=$apiKey&radius=1000&extensions=all';
  try {
    var response = await http.get(url);
    return response['regeocode']['formatted_address'];
  } catch (e) {
    ToastUtil.showError('查询过程中出现错误: $e');
    return '';
  }
}
